<?php
/**
 * 测试
 * @author 鸣枫
 *
 */
class Site extends CI_Controller{
    
    public function index(){
        echo md5('ryb2016');
        die('hello word!');
    }
    /**
     * 前
     */
    public function _remap($method)
    {
//         file_put_contents(APPPATH.'logs/weixin_error.log', date('Y-m-d H:i:s') . " ". "\n", FILE_APPEND);
//         echo md5('ryb2016');
//         echo $method;
        $template=array(
            'touser'=>'okNb0t9wZ46KKlQ8ZzunxQTmxjLk',
            'template_id'=>"WmRwDwfy9uaSVNXTo7klszBF9j6BsULEbEW_gz-jUeY",    //模板的id
            'url'=>DOMAIN_MAIN.'/courserecord',
            'topcolor'=>"#173177",
            'data'=>array(
                'first'=>array('value'=>urlencode('ceshi'),'color'=>"#173177"),   
                'book_id'=>array('value'=>urlencode('1234567'),'color'=>'#173177'),
                "remark"=>array("value"=>"欢迎再次购买！", "color"=>"#173177")
            )
        );
        
        require_once(APPPATH . "/third_party/wechat/wxpay/lib/WxTemplate.Api.php");
        $WxTemplateApi = new WxTemplateApi();
        $res = $WxTemplateApi->send_temp_msg(urldecode(json_encode($template)));
        
        $this->load->model('send_template_msg_log_model');
        $columns = array(
            'book_id'=>32,
            'res'=>json_encode($res),
            'type'=>Send_template_msg_log_model::TYPE_1,
            'create_date'=>date('Y-m-d H:i:s'),
            'update_date'=>date('Y-m-d H:i:s')
        );
        $this->send_template_msg_log_model->insert($columns);
    }
    
    public function shoes($sandals, $id)
    {
        //echo $this->input->get('sandals');
        //echo '<pre>';print_r($_GET);die();
        echo $sandals;
        //echo $id;
    }
}